// 过滤器
let time = val =>{
  var date = new Date(val) // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
  var Y = date.getFullYear() + '-'
  var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth()+ 1) + '-'
  var D = date.getDate() + ' '
  var h = date.getHours() + ':'
  var m = date.getMinutes()
  // var s = date.getSeconds()
  return Y + M + D + h + m
}

let onDelivery = val => {
  return val == 0 ? '不代收货款 ' :  '代收货款';
}
let isUrgent = val => {
  return val == 0 ? '不加急 ' :  '加急';
}
let isInvoice = val => {
  return val == 0 ? '不开票 ' :  '开票';
}
let isPay = val =>{
  return val == 0 ? ' (未付款) ' :  '(已付款)';
}
let formatStatus = val =>{
  return val == 1 ? '下架' : val == 0 ? '上架' : '未知';
}
let Price = val =>{
  return val === null ? '未报价' : (val/100).toFixed(2)+ ' (元)' 
}
// bannerlist 上下架过滤
let Status = val =>{
      return val == 1 ? '已上架' : val == 0 ? '已下架' : '未知';
}
let transStatus = val =>{
  return val===1?'审核中':'等待运输'
}
let Plate = val =>{
  return val===null?'未绑定车辆':val
}
let StatusWaybill = val =>{
  return val == 1 ? '审核中' : val == 2 ? '等待运输中' :  val == 3 ? '运输中 ' : '已结束'
}
let formatList =val => {
  return val == 0 ? '列表显示' :val == 1 ? '列表不显示' : '未知'
}
export default {
  time,onDelivery,isUrgent,isInvoice,isPay,formatStatus,Price,Status,transStatus,Plate,StatusWaybill,formatList
}